#Abandonded_Quarters_Graph.py
#method to count the specific messages by tech center and month 
#written by Nick Shine
#November 2020

import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt 

#set directory
df1 = pd.read_excel('AbandondedDataNoTotals_allQartersCombined.xlsx', '2016-2020Q3')
#df1 = pd.read_excel('AbandondedDataNoTotals_2020MonthsCombined.xlsx')

listOfTechCenters = ['TC1600 BioTech & O Chem',
					 'TC1700 Chem & Materials Eng',
					 'TC2100 Computer Architecture',
					 'TC2400 Computer Networks',
					 'TC2600 Communications',
					 'TC2800 Semiconductors',
					 'TC2900 Design',
					 'TC3600 Transport/Construction/ECom',
					 'TC3700 Mech Eng & Med Devices',
					 'TC3900 REexam/Abandonments',
					 'tcOther']

months = ['Jan',
		  'Feb',
		  'Mar',
		  'Apr',
		  'May',
		  'Jun',
		  'Jul',
		  'Aug',
		  'Sept',
		  'Oct',
		  'Nov']

listOfQuarters = ['2016-Q1', '2016-Q2', '2016-Q3', '2016-Q4', 
				  '2017-Q1', '2017-Q2', '2017-Q3', '2017-Q4',
				  '2018-Q1', '2018-Q2', '2018-Q3', '2018-Q4',
				  '2019-Q1', '2019-Q2', '2019-Q3', '2019-Q4',
				  '2020-Q1', '2020-Q2', '2020-Q3']#'2020-Q4']



plt.style.use('seaborn-whitegrid')

plt.plot(df1['TC1600'], label=listOfTechCenters[0])
plt.plot(df1['TC1700'], label=listOfTechCenters[1])
plt.plot(df1['TC2100'], label=listOfTechCenters[2])
plt.plot(df1['TC2400'], label=listOfTechCenters[3])
plt.plot(df1['TC2600'], label=listOfTechCenters[4])
plt.plot(df1['TC2800'], label=listOfTechCenters[5])
plt.plot(df1['TC3600'], label=listOfTechCenters[7])
plt.plot(df1['TC3700'], label=listOfTechCenters[8])


plt.xticks(np.arange(19), listOfQuarters, rotation=60)
#plt.xticks(np.arange(11), months, rotation=60)

plt.title('Abandoned Applications by Tech Center')

plt.xlabel('Years in Quarters')
#plt.xlabel('2020')

plt.ylabel('Number of Applications')

plt.grid(True, color='k', linestyle=':')

plt.legend(bbox_to_anchor=(1.13,1))

plt.show()

print(plt.style.available)